<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>底部导航栏图标生成器</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            max-width: 800px;
            margin: 0 auto;
            padding: 20px;
            background-color: #f5f5f5;
        }
        .container {
            background: white;
            padding: 20px;
            border-radius: 10px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        }
        .icon-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 20px;
            margin: 20px 0;
        }
        .icon-item {
            text-align: center;
            padding: 20px;
            border: 2px solid #eee;
            border-radius: 10px;
            background: white;
        }
        .icon-item:hover {
            border-color: #ff6b35;
        }
        .icon {
            font-size: 48px;
            margin-bottom: 10px;
        }
        .icon-name {
            font-size: 14px;
            color: #666;
            margin-bottom: 10px;
        }
        .download-btn {
            background: #ff6b35;
            color: white;
            border: none;
            padding: 8px 16px;
            border-radius: 5px;
            cursor: pointer;
            font-size: 12px;
        }
        .download-btn:hover {
            background: #ff8c42;
        }
        .instructions {
            background: #f8f9fa;
            padding: 15px;
            border-radius: 5px;
            margin: 20px 0;
            border-left: 4px solid #ff6b35;
        }
        .note {
            background: #fff3cd;
            padding: 15px;
            border-radius: 5px;
            margin: 20px 0;
            border-left: 4px solid #ffc107;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>底部导航栏图标生成器</h1>
        
        <div class="instructions">
            <h3>使用说明：</h3>
            <p>点击下方的下载按钮可以生成简单的图标文件。这些图标是基于emoji生成的，适合开发测试使用。</p>
            <p>生产环境建议使用专业设计的PNG图标文件。</p>
        </div>

        <div class="icon-grid">
            <div class="icon-item">
                <div class="icon">🏠</div>
                <div class="icon-name">首页</div>
                <button class="download-btn" onclick="downloadIcon('home', '🏠')">下载</button>
            </div>
            
            <div class="icon-item">
                <div class="icon">🔶</div>
                <div class="icon-name">分类</div>
                <button class="download-btn" onclick="downloadIcon('categories', '🔶')">下载</button>
            </div>
            
            <div class="icon-item">
                <div class="icon">🛒</div>
                <div class="icon-name">购物车</div>
                <button class="download-btn" onclick="downloadIcon('cart', '🛒')">下载</button>
            </div>
            
            <div class="icon-item">
                <div class="icon">👤</div>
                <div class="icon-name">我的</div>
                <button class="download-btn" onclick="downloadIcon('profile', '👤')">下载</button>
            </div>
        </div>

        <div class="note">
            <h3>注意事项：</h3>
            <ul>
                <li>生成的图标文件需要重命名为对应的文件名</li>
                <li>建议图标尺寸：24x24 或 32x32 像素</li>
                <li>文件格式：PNG</li>
                <li>需要准备激活状态和普通状态两种图标</li>
            </ul>
        </div>

        <div class="instructions">
            <h3>文件命名规范：</h3>
            <p><code>static/tabbar/home.png</code> - 首页图标</p>
            <p><code>static/tabbar/home-active.png</code> - 首页激活图标</p>
            <p><code>static/tabbar/categories.png</code> - 分类图标</p>
            <p><code>static/tabbar/categories-active.png</code> - 分类激活图标</p>
            <p><code>static/tabbar/cart.png</code> - 购物车图标</p>
            <p><code>static/tabbar/cart-active.png</code> - 购物车激活图标</p>
            <p><code>static/tabbar/profile.png</code> - 个人中心图标</p>
            <p><code>static/tabbar/profile-active.png</code> - 个人中心激活图标</p>
        </div>
    </div>

    <script>
        function downloadIcon(name, emoji) {
            // 创建canvas
            const canvas = document.createElement('canvas');
            const ctx = canvas.getContext('2d');
            
            // 设置画布大小
            canvas.width = 32;
            canvas.height = 32;
            
            // 设置背景色
            ctx.fillStyle = '#ffffff';
            ctx.fillRect(0, 0, 32, 32);
            
            // 设置文字样式
            ctx.font = '24px Arial';
            ctx.textAlign = 'center';
            ctx.textBaseline = 'middle';
            
            // 绘制emoji
            ctx.fillText(emoji, 16, 16);
            
            // 转换为blob并下载
            canvas.toBlob(function(blob) {
                const url = URL.createObjectURL(blob);
                const a = document.createElement('a');
                a.href = url;
                a.download = `${name}.png`;
                document.body.appendChild(a);
                a.click();
                document.body.removeChild(a);
                URL.revokeObjectURL(url);
            });
        }
    </script>
</body>
</html>
